﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Components;

namespace Model
{
    /// <summary>
    /// 分页返回值  Zhuqiangwei 2009-08-16
    /// </summary>
    public class ReturnPageData
    {
        private int _allRowCount;

        public ReturnPageData(){}

        public ReturnPageData(int allRowCount)
        {
            _allRowCount = allRowCount;
        }

        public ReturnPageData(DataTable currnetPageData, int allRowCount)
        {
            _currnetPageData = currnetPageData;
            _allRowCount = allRowCount;
        }

        /// <summary>
        /// 总记录数
        /// </summary>
        public int AllRowCount
        {
            get { return _allRowCount; }
            set { _allRowCount = value; }
        }

        private DataTable _currnetPageData;

        /// <summary>
        /// 当前页的数据
        /// </summary>
        public DataTable CurrnetPageData
        {
            get { return _currnetPageData; }
            set { _currnetPageData = value; }
        }

        /// <summary>
        /// 合计
        /// </summary>
        public DataTable SummaryData { get; set; }

        /// <summary>
        /// 当前页的数据
        /// </summary>
        public DataTable ParseData(string data)
        {
            string value = StringUtil.UnZip(data);

            _currnetPageData = Json.XmlToTable(value);

            return _currnetPageData;
        }

        public DataTable ParseSummary(string data)
        {
            string value = StringUtil.UnZip(data);

            SummaryData = Json.XmlToTable(value);

            return SummaryData;
        }

        private Pager _pagerInfo;

        /// <summary>
        /// 分页条件信息
        /// </summary>
        public Pager PagerInfo
        {
            get { return _pagerInfo; }
            set { _pagerInfo = value; }
        }
    }
}
